package org.wevil.controller.witcher3;

import org.wevil.enumu.ResultEnum;
import org.wevil.params.add.witcher3.Witcher3CharactersAP;
import org.wevil.params.delete.DeleteParam;
import org.wevil.params.detail.DetailParam;
import org.wevil.params.page.witcher3.Witcher3CharactersPP;
import org.wevil.params.update.witcher3.Witcher3CharactersUP;
import org.wevil.service.witcher3.Witcher3CharactersService;
import org.wevil.vo.Result;
import org.wevil.util.page.PageResult;
import org.wevil.vo.detail.witcher3.Witcher3CharactersDVo;
import org.wevil.vo.list.witcher3.Witcher3CharactersLVo;


import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/** 巫师3-角色信息管理 */
@RestController
@RequestMapping("/witcher3/characters")
public class Witcher3CharactersController {

    @Resource
    Witcher3CharactersService service;

    /** 创建 */
    @PostMapping("/create")
    public Result<String> create(
            @RequestBody @Validated Witcher3CharactersAP param
    ) {
        service.create(param);
        return Result.success();
    }

    /** 修改 */
    @PutMapping("/update")
    public Result<String> update(
            @RequestBody @Validated Witcher3CharactersUP param
    ) {
        service.update(param);
        return Result.success();
    }

    /** 删除 */
    @DeleteMapping("/delete")
    public Result<String> delete(
            @RequestBody @Validated DeleteParam param
    ) {
        service.delete(param);
        return Result.success();
    }

    /** 详情 */
    @PostMapping("/detail")
    public Result<Witcher3CharactersDVo> detail(
            @RequestBody @Validated DetailParam param
    ) {
        Witcher3CharactersDVo data = service.detail(param);
        return Result.success(data);
    }

    /** 分页 */
    @PostMapping("/page")
    public Result<PageResult<Witcher3CharactersLVo>> page(
            @RequestBody @Validated Witcher3CharactersPP param
    ) {
        PageResult<Witcher3CharactersLVo> data = service.page(param);
        return Result.success(data);
    }
}
